package com.dreamlin.demo;

import android.graphics.Bitmap;

import androidx.annotation.NonNull;

public class TaskBean implements Cloneable {

    private String fileName;
    private String url;
    private String savePath;
    private long length;
    private long callInterval;
    private int autoRetry;
    private int threadNum;
    private Bitmap bitmap;
    private boolean isFinish = false;

    public TaskBean(String url) {
        this.url = url;
    }

    public String getFileName() {
        return fileName;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getSavePath() {
        return savePath;
    }

    public void setSavePath(String savePath) {
        this.savePath = savePath;
    }

    public long getLength() {
        return length;
    }

    public void setLength(long length) {
        this.length = length;
    }

    public long getCallInterval() {
        return callInterval;
    }

    public void setCallInterval(long callInterval) {
        this.callInterval = callInterval;
    }

    public int getAutoRetry() {
        return autoRetry;
    }

    public void setAutoRetry(int autoRetry) {
        this.autoRetry = autoRetry;
    }

    public int getThreadNum() {
        return threadNum;
    }

    public void setThreadNum(int threadNum) {
        this.threadNum = threadNum;
    }

    public Bitmap getBitmap() {
        return bitmap;
    }

    public void setBitmap(Bitmap bitmap) {
        this.bitmap = bitmap;
    }

    public boolean isFinish() {
        return isFinish;
    }

    public void setFinish(boolean finish) {
        isFinish = finish;
    }

    @NonNull
    @Override
    public TaskBean clone() {
        try {
            return (TaskBean) super.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        TaskBean taskBean = new TaskBean(url);
        taskBean.setAutoRetry(autoRetry);
        taskBean.setFileName(fileName);
        taskBean.setCallInterval(callInterval);
        taskBean.setSavePath(savePath);
        taskBean.setThreadNum(threadNum);
        return taskBean;
    }
}
